class fragments::ubuntu_java_env {
  $java_env_pkgs = [
    'openjdk-8-jdk-headless',
    'tomcat8',
    'libtcnative-1'
  ]
  package { $java_env_pkgs:
    ensure => present,
  }
  file { '/etc/tomcat8/server.xml':
    ensure => present,
    owner => root,
    mode => '0644',
    source => 'puppet:///modules/fragments/ubuntu_tomcat8_server.xml',
    notify => Service['tomcat8']
  }
  service { 'tomcat8':
    ensure => running,
  }
  # ensure tomcat webapps directory has group write permission
  file { '/var/lib/tomcat8/webapps':
    ensure => directory,
    mode => '0775',
    require => Package['tomcat8']
  }
}
